function turnQuery(data) {
  var res = [];
  var keys = Object.keys(data);
  for (let i = 0; i < keys.length; i++) {
    var str = keys[i] + '=' + data[keys[i]];
    res.push(str);
  }
  return res.join('&');
}

function getData(options) {
  var xhr = new XMLHttpRequest();
  var qs = turnQuery(options.data);

  xhr.open('GET', options.url + '?' + qs);
  xhr.send();
  xhr.onreadystatechange = function () {
    if (xhr.readyState == 4 && xhr.status == 200) {
      var result = JSON.parse(xhr.responseText);
      options.success(result.data);
    }
  };
}
